﻿using System.Reflection;
using WYJ.SDK.Core;

public static partial class Extensions
{
    public static Dictionary<string, Dictionary<string, Type>> Lookup(this Assembly assembly, Func<Type, bool>? filter = null)
    {
        var types = assembly.GetTypes().FindTags<Tag>(filter).GroupBy(X => X.Item1.Group)
            .ToDictionary(x => x.Key, x => x.ToDictionary(y => y.Item1.Name ?? y.Item2.Name, y => y.Item2));
        return types;
    }
}
